package com.czk.tx.dao.impl;

import com.czk.tx.dao.MoneyDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @Author:ChenZhangKun
 * @Date: 2020/11/24 20:17
 */
@Repository
public class MoneyDaoImpl implements MoneyDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Override
    public void add() {
        String sql="update count set money=money+? where name =?";
        jdbcTemplate.update(sql,10,"nzq");
    }

    @Override
    public void reduce() {
        String sql="update count set money=money-? where name =?";
        int i=1/0;
        jdbcTemplate.update(sql,10,"czk");
    }
}
